Release 10.1A: OpenEdge Development:
Programming Interfaces
Telling Progress how to continue processing
When you modify a field or variable, pressing GO tells Progress to accept the data in all the modified fields and variables in the current statement and to go on to the next statement in the procedure.
As the following figure shows, if you press GO while the cursor is in the name, credit–limit, or sales–rep fields, Progress continues on to the next statement in the procedure, which is
END. The procedure then returns to the beginning of theFOREACHloop.i-intro.p
![]()
You might want to define function keys that tell Progress to continue processing data a certain way. You can use the
GO–ONphrase with theSETorUPDATEstatement to do this, as shown in the following procedure:
In this example, if the user presses F8, F10, or F12 while updating the customer data, the procedure immediately goes on to the next statement in the procedure. Let’s take a closer look at this procedure.
Any key you can press while running a Progress procedure has a code, a function, and a label associated with it. The code of a key is an integer value that Progress uses to identify that key. For example, the code of F1 is 301. The function of a key is the work that Progress does when you press the key. For example, the function of the F1 key may be
HELP. The label of a key is the actual label that appears on the keyboard key. The label of the F1 key is F1.As shown earlier, you can use the
KEYLABEL,KEYCODE,KEYFUNCTION, andKBLABELfunctions to convert key labels, key codes, and key functions. In addition to these functions, theLASTKEYfunction returns the key code of the last key pressed.You can use the functions described in this table to monitor the keys being pressed, as in this example:
Run procedure
i-keys.pto see how the different keys you press translate into key codes, key labels, and key functions.Now, run the
i-gon1.pprocedure. You see a screen similar to the one shown in Figure 4–5.Figure 4–5: The i-gon1.p procedure
![]()
While updating the customer information, press F9, F10, F11, or use either of the standard techniques to signal the end of data entry, Progress goes on to the next statement in the procedure. If you press any other key, Progress does not continue on to the next statement in the procedure, but instead performs the data entry operation associated with that key. If you press END-ERROR, Progress performs the default
ENDKEYprocessing ofUNDO,LEAVE.If Progress does continue on to the next statement in the procedure, the
CASEstatement determines the action to take by checking the value of the last key pressed.The procedure
i-gon2.pshows how you can achieve the same functionality in an event-driven application:
Use the
Note: In a larger program, you must be careful of the scope of theANYWHEREoption of theONstatement to set up triggers that execute no matter which widget has input focus. Ini-gon2.p, theANYWHEREoption is used to assign triggers to function keys.ANYWHEREtrigger.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |